package org.jeecg.modules.zhima.center.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.modules.zhima.center.entity.PmsKeywords;
import org.jeecg.modules.zhima.center.mapper.PmsKeywordsMapper;
import org.jeecg.modules.zhima.center.service.IPmsKeywordsService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: pms_keywords
 * @Author: jeecg-boot
 * @Date:   2020-09-15
 * @Version: V1.0
 */
@Service
public class PmsKeywordsServiceImpl extends ServiceImpl<PmsKeywordsMapper, PmsKeywords> implements IPmsKeywordsService {

    @Override
    public List<PmsKeywords> listDefault(Integer limit) {
        return list(new LambdaQueryWrapper<PmsKeywords>().eq(PmsKeywords::getIsDefault, 1).last("limit " + limit));
    }

    @Override
    public List<PmsKeywords> listHot(Integer limit) {
        return list(new LambdaQueryWrapper<PmsKeywords>().eq(PmsKeywords::getIsHot, 1).last("limit " + limit));
    }

    @Override
    public List<PmsKeywords> list(String keyword, Integer limit) {
        return list(new LambdaQueryWrapper<PmsKeywords>().likeRight(PmsKeywords::getKeyword, keyword).last("limit " + limit));
    }
}
